package org.sun.sunshine.io.nio.channel;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;

public class DatagramChannelClientDemo {

    public static void main(String[] args) {
        sendUdp();
    }

    public static void sendUdp() {
        try(DatagramChannel datagramChannel=DatagramChannel.open();){
            datagramChannel.configureBlocking(false);
            datagramChannel.send(ByteBuffer.wrap("hello".getBytes()), new InetSocketAddress("127.0.0.1",9090));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


}
